
public class ThreadIntro {
	public static void main(String[] args) {
		
		// start() makes asynchronous call
		(new Worker()).start(); 
		
		//one way
//		while (true) {
//			System.out.println(Thread.currentThread().getName());
//		}

		//better way
		new Thread(new BetterWorker()).start();
		
		new Thread()
	
	}
	
}

class Worker extends Thread {
	@Override
	public void run() {
		while (true) {
			System.out.println(this.getName());
		}
	}
	
}

class BetterWorker implements Runnable {
	public void run() {
		while (true) {
			System.out.println(Thread.currentThread().getName());
		}
	}
	
}